﻿@{
    ViewBag.Title = "UserManagement";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var Grid = new WebGrid(source: ViewBag.data, canSort: true, canPage: true, rowsPerPage: 10);
}

<div id="content" class="roundedBoders">
    <!----Title------->
    <div id="title" class="b2">
        <h2>User</h2>
        <!---Title action--->
        <div id="titleActions">
            <!---ListSearch--->
            @using (Html.BeginForm("ResultFtpAction", "Ftp", FormMethod.Get))
            {
                <div class="listSearch actionBlock" style="padding:20px; margin-bottom:15px">
                     
						<div class="search">
							<label for="search">Recherche</label>
                              @Html.TextBox("name", "", new { @class = "text", @style = "height:20px" })
							@*<input style="height:30px" type="text" name="search" id="search" class="text" />*@
						</div>
						<div class="submit">
							    <button type="submit" id="search-button" class="button"><strong><img src="@Url.Content("~/Content/Admin/home/images/search_4.png")" alt="comments" class="icon " /></strong></button>
						</div>
 
                </div>
            }
            <!-----.ListSearch------>
        </div>
        <!---Tittle action----->
    </div>
    <!---/Title--->
    <!---Inner Content----->
    <div id="innerContent">
        @Html.ActionLink("Create user", "Create", "User")
        @Grid.GetHtml(tableStyle:"listTable", headerStyle:"first",columns:Grid.Columns(
            Grid.Column("UserID","ID"),
            Grid.Column("UserName","UserName"),
            Grid.Column("Email","Email"),
            Grid.Column("CreateDate","Create Date"),

                      Grid.Column("aa", header: "", style: "text-align-center", format: (item) => new HtmlString(Html.ActionLink("Delete", "Delete", new { id = item.UserID }, new { onclick = "return confirm('Are you sure you wish to delete this log?');" }).ToString())),
                      Grid.Column("Edit",header:"",style:"text-align-center",format: (item) => new HtmlString(Html.ActionLink("Edit", "Edit", new { id = item.UserID }).ToString()))
                  ))

         @{
                if (!string.IsNullOrWhiteSpace(Grid.SortColumn))
                {
                   <script type="text/javascript">
                       $('thead > tr > th > a[href*="sort=@Grid.SortColumn"]').parent().append('@(Grid.SortDirection == SortDirection.Ascending ? "^" : "v")');
                   </script>
                }
            }
    </div>
</div>
